package com.gs.gaosheng.controller.web;

import com.gs.common.core.domain.AjaxResult;
import com.gs.gaosheng.service.ShowGoodsService;
import com.gs.gaosheng.vo.CouponVo;
import com.gs.gaosheng.vo.ShowVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class ShowGoodsWebController {


    @Resource
    private ShowGoodsService showGoodsService;


    @GetMapping("/selectByStatus")
    public AjaxResult selectByStatus(Long statusName) {
        List<ShowVo> showVoList = showGoodsService.selectByStatus(statusName);

        return AjaxResult.success("成功", showVoList);
    }


    @GetMapping("/selectByGoodsId")
    public AjaxResult selectByGoodsId(Long goodsId) {
        List<ShowVo> showVo = showGoodsService.selectByGoodsId(goodsId);
        return AjaxResult.success("成功", showVo);
    }

    @GetMapping("/selectByType")
    public AjaxResult selectByType(Long typeId) {
        List<ShowVo> list = showGoodsService.selectByType(typeId);
        return AjaxResult.success("成功", list);
    }

    @GetMapping("/selectByLike")
    public AjaxResult selectByLike(String searchName) {
        List<ShowVo> list = showGoodsService.selectByLike(searchName);
        return AjaxResult.success("成功", list);
    }

    @GetMapping("/selectCouponByUserId")
    public AjaxResult selectCouponByUserId(Long userId) {
        List<CouponVo> list = showGoodsService.selectCouponByUserId(userId);
        return AjaxResult.success("成功", list);
    }

    @GetMapping("/selectCouponByCouponStatus")
    public AjaxResult selectCouponByCouponStatus(Long userId,Long couponStatus) {
        List<CouponVo> list = showGoodsService.selectCouponByCouponStatus(userId,couponStatus);
        return AjaxResult.success("成功", list);
    }

}